import 'package:flutter/material.dart';
import 'package:yp/config/config.dart';
import 'package:flutter_html/flutter_html.dart';
import 'package:get/get.dart';
import 'package:webview_flutter/webview_flutter.dart';

import 'logic.dart';

class GetPointsMethodPage extends StatelessWidget {
  final logic = Get.put(GetPointsMethodLogic());
  final state = Get.find<GetPointsMethodLogic>().state;

  @override
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: AppBar(
        backgroundColor: Config.mainColor,
        brightness: Brightness.light,
        iconTheme: IconThemeData(color: Colors.white),
        title: Text(
          "如何获得积分",
          style: TextStyle(fontSize: 17),
        ),
        centerTitle: true,
      ),
      body: _buildGetPointsMethodPageBody(),
    );
  }

  Widget _buildGetPointsMethodPageBody() {
    return GetBuilder<GetPointsMethodLogic>(
      builder: (logic) {
        if (logic.state.infoMap != null && logic.state.infoMap["ec_value"] != null) {
          return Container(
            child: Html(
              data: logic.state.infoMap["ec_value"],
            ),
          );
        } else {
          return Center(
            child: Container()
          );
        }
      },
    );
  }

}
